#include "qresistoritem.h"

QResistorItem::QResistorItem(QStringList header,QStringList values)
	: QBDDItem(header,values)
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	m_type = PART_RESISTOR;
	m_bddFile = DB_RESISTOR_FILE;

	if(header.contains(LA_DESC))
	{
		QString desc = values[header.indexOf(LA_DESC)];
		m_properties[PART_PACKAGE]			= extractFrom(desc,RE_PACKAGE);
		m_properties[PART_POWER]			= extractFrom(desc,RE_POWER);
		m_properties[PART_VOLTAGE]			= extractFrom(desc,RE_VOLTAGE);
		m_properties[PART_TOLERANCE]		= extractFrom(desc,RE_TOLERANCE);
		m_properties[PART_RESISTOR_VALUE]	= QNormalize::units(RE_SPECIFIC_RESISTOR_VALUE,extractFrom(desc,RE_RESISTOR_VALUE),PART_RESISTOR_UNIT,NZ_M_IS_MEGA);
	}
	else
		m_properties[PART_PACKAGE] = m_properties[PART_POWER] = m_properties[PART_VOLTAGE] = m_properties[PART_TOLERANCE] = m_properties[PART_RESISTOR_VALUE] =PART_UNKNOWN;
}

QResistorItem::QResistorItem(QByteArray in)
	: QBDDItem(in)
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	m_type = PART_RESISTOR;
   m_bddFile = DB_RESISTOR_FILE;
}

QResistorItem::~QResistorItem()
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
}


QStringList QResistorItem::cat_1() 
{ 
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	QStringList list;
	list << LA_RESISTOR_TYPE_1; 
	return list; 
}

QStringList QResistorItem::cat_2()
{ 
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	QStringList list;
	list << LA_RESISTOR_TYPE_2; 
	return list; 
}